#pragma once

#include "utils/object.h"

#include <muduo/base/SignalSlot.h>

#include <functional>

namespace muduo {
namespace net {
class TimerId;
class EventLoopThread;
}
}

namespace fusion_perception {

class TimeSync;
class Associator;
class TrackerManager;

class FusionPerception {
public:
    using FusedResultCB = std::function<void(const ObjectSptrVector&)>;

public:
    FusionPerception(void);
    ~FusionPerception(void);

    void pushObjectSptrVector(std::string frameId, ObjectSptrVector objectSptrVector);
    void registerFusedResultCB(FusedResultCB fusedResultCB);

private:
    void onTimeout(void);

private:
    std::shared_ptr<muduo::net::TimerId> timerIdSptr_ { nullptr };
    std::shared_ptr<muduo::net::EventLoopThread> eventLoopThreadSptr_ { nullptr };

    std::shared_ptr<TimeSync> timeSyncSptr_ { nullptr };
    std::shared_ptr<TrackerManager> trackerManagerSptr_ { nullptr };
    std::shared_ptr<Associator> associatorSptr_ { nullptr };

    std::vector<muduo::Slot> slots_;
    muduo::Signal<void(ObjectSptrVector)> signal_;
};
}
